//
//  LZSearchCollectionViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/11.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "LZSearchCollectionViewCell.h"
#import "FitHeader.h"
#import "Model.h"

@implementation LZSearchCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        _nicknameLabel = [[UILabel alloc]init];
        _nicknameLabel.layer.borderWidth = .5;
        _nicknameLabel.layer.cornerRadius = 8;
        _nicknameLabel.layer.borderColor = [UIColor colorWithRed:0.96 green:0.96 blue:0.96 alpha:1].CGColor;
        _nicknameLabel.font = [UIFont systemFontOfSize:17];
        _nicknameLabel.textAlignment = 1;
        [self.contentView addSubview:_nicknameLabel];
        [self changeColor];
    }
    return self;
}

-(void)changeColor{
//    self.backgroundColor = [Model shareInstance].ViewColor;
}


- (void)layoutSubviews{
    [super layoutSubviews];
    
    
}
- (void)setString:(NSString *)string{
    CGRect rect = [string boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, 40 * FITHeight) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17], NSFontAttributeName, nil] context:nil];
//    CGSizeMake(ceill(rect.size.width + 1), 40 * FITHeight);
    _nicknameLabel.frame = CGRectMake(0, 0, ceill(rect.size.width + 1) + 5, 30 * FITHeight);
    _nicknameLabel.text = string;
    [self changeColor];
}
@end
